home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Experimental BBS Explossion 3
/
Experimental BBS Explossion III.iso
/
msdos
/
s3tool10.zip
/
TSTQUERY.BAT
< prev
next >
Wrap
DOS Batch File
|
1993-09-25
|
2KB
|
78 lines
@echo off
REM **********************************
REM * S3 QUERY TEST/DEMO BATCH FILE *
REM * BY: George Spafford *
REM * Tested in MS DOS 5.0 *
REM * version 1.0 09/25/93 *
REM * Requires the S3 Software QUERY *
REM * program for DOS in order to run*
REM **********************************
REM * If you learn from this batch *
REM * file, then please register your*
REM * copy of S3 Tools. *
REM **********************************
cls
:aDEMO
echo Press the lowercase (a) now. The batch file will only continue if you
echo press the lowercase (a) key.
query 97
REM The above line expressly states that an ASCII code of 97 must be entered
REM before continuing on.
if errorlevel 97 echo (a) was pressed
:abcDEMO
echo.
echo.
echo Now, press either lowercase a, b or c. QUERY will watch for one of those
echo three characters to be pressed before it continues on.
query 97-99
REM The above line tells S3 QUERY that the user must press a, b or c.
REM They are the keys that return ASCII codes 97, 98 and 99 respectively.
REM Note that you should test errorlevels from the highest possible value
REM to the lowest. Here, we know that 99 is the highest and 97 the lowest.
REM I personally really wish Microsoft had designed the errorlevels to be
REM a true Boolean equals rather than equal to or greater than.
REM Also, gosub would have been nice. With Mr. Gates saying that the DOS
REM era is coming to a close, I suppose they will never add the enhancements.
if errorlevel 99 goto ABC_c
if errorlevel 98 goto ABC_b
if errorlevel 97 goto ABC_a
:ABC_c
echo (c) was pressed
goto ESCdemo
:ABC_b
echo (b) was pressed
goto ESCdemo
:ABC_a
echo (a) was pressed
goto ESCdemo
:ESCdemo
echo.
echo.
echo OK now press the ESCape key. The batch file will continue regardless
echo of what you press but only the ESCape key will perform the correct task
query
REM The next line is an error trap. A batch file equal sign really means
REM greater than or equal to. Thus, if errorlevel=28 was omitted, then
REM the batch file will say ESC was pressed as long as the return code was
REM greater than or equal to 27.
if errorlevel 28 goto FINISH
if errorlevel 27 echo ESC was pressed
:FINISH
echo.
echo.